//
//  GoodsCell.m
//  sensen_ios
//
//  Created by pro on 16/2/23.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "ProductCell.h"

@implementation ProductCell

- (void)awakeFromNib {
    
    self.backgroundColor = [UIColor whiteColor];
    _iconImgView.image = [UIImage imageWithColor:[UIColor lightGrayColor]];
    
    _nameLabel.text = @"森森鱼缸水族箱HLXW超白玻璃生态鱼缸大中型造景过滤鱼缸";
    _priceLabel.text = @"￥2819";
    _priceLabel.textColor = RED_COLOR;
    _priceLabel.font = B_FONT(15);
}


- (void)setModel:(ProductModel *)model {
    _model = model;
    
    [self _layoutUI];
}
- (void)_layoutUI {
    
    // 图片
    [_iconImgView setImageURLStr:_model.img placeholder:DEFAULT_IMAGE];
    // 名字
    _nameLabel.text = _model.name;
    // 价格
    _priceLabel.text = [NSString stringWithFormat:@"￥%@", _model.price];
    //一 创建NSMutableAttributedString 对象
    NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:_priceLabel.text];
    // 字体
    [attrString addAttribute:NSFontAttributeName
                       value:FONT(12)
                       range:NSMakeRange(_priceLabel.text.length - 2, 2)];
 
    _priceLabel.attributedText = attrString;
}

@end
